Skip the rebuild when rector-src main is a release tag commit#731
Merged
Conversation
A tagged main is already published by the tag build of rector-src. A
dispatched build would race that build for the push to rectorphp/rector,
and the loser of the race fails on a non fast forward push.
Tags are resolved with git ls-remote, which lists a lightweight tag with
the commit itself and an annotated tag with an extra "^{}" line, so both
kinds are matched. rector-src has 36 annotated tags among 574.
Member
Author
|
Let's see if this helps :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #730. When
rector-srcmain sits on a release tag commit, that commit is already being published torectorphp/rectorby the tag build. Dispatching a second build makes the two race each other forgit push origin main, and the loser fails on a non fast forward push. When the loser is the tag build, it dies before reachinggit tag/git push origin <tag>, so the release tag never lands.Why git ls-remote and not the tags API
git/refs/tagsexposes.object.sha, which for an annotated tag is the sha of the tag object, not of the commit, so a comparison against a commit sha silently never matches.rector-srccarries 36 annotated tags among 574. The current release tags happen to be lightweight, so the API version would work today and quietly stop working the first time a tag is cut withgit tag -a.git ls-remote --tagslists a lightweight tag with the commit itself and an annotated tag with an extra^{}line holding the dereferenced commit, so matching on line start covers both. It also needs no token.The empty
MAIN_SHAcheck is not decoration: without it a failed lookup leavesgrep -q "^"matching every line, which would silently skip every future dispatch. Failing loudly is better.Verified
The step script was run as is against live
rector-src:c607ef0, untagged, writes no output, so the dispatch runs2.5.7(653ec23), detected, writestagged=true, so the dispatch is skipped0.11.39(771a339), detected through its^{}lineWhat this does not cover
A dispatch can still overlap a tag build if a new
rector-srccommit lands on main after the tag is pushed, since main then no longer points at the tagged commit while the tag build is still running. Closing that fully needs aconcurrency:group onbuild_scoped_rector, which also covers the pre existing push versus push overlap that the workflow already carries a comment about. Separate change,rector-srcside.